-
-
Notifications
You must be signed in to change notification settings - Fork 10
feat: add support for nitro v3 #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@schplitt is attempting to deploy a commit to the HRCD Projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for following the naming conventions! 🙏 |
|
@schplitt I don't know if it's better, but I'd prefer to have an entry point that looks more like 'evlog/nitro/v3'. I don't really like having |
Should the 'complete' playground be like v2 or even more extensive? |
Ideally similar, but otherwise just a little less comprehensive is fine with me too. It's just so we can easily launch the app and quickly test that everything works without having to do too much setup. |
|
Alright |
|
Improved the playground to serve a basic UI to visualize the error aswell Also moved nitrov3 to nitro/v3 in dist 🙂 |
|
I noticed that in v3 the error is transformed into an unhandled We would need to overwrite the entire error handler to be able to handle |
I'll try to see how we can do that too |
commit: |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
I am not sure what the future plans for nuxt and evlog are but as nitro will become framework agnostic and interop with vite plugins, maybe it would be a nice Idea to experiment with nitro modules: So that it could also be used with tanstack, etc.? Let me know what your plans are going forward regarding nitro v3 and I'll see how I can help🙂 |
|
@schplitt Oh, nice! So I think we should implement it like that, and clean up the repo to have a Nitro v2 playground and a Nitro v3 (update the PR with the latest features I added) |
What about your preferred solution for this? |
So I would lean towards "simplicity" and extend HTTPError |
|
I've looked into this a bit. First, we would make Evlog dependend on H3 v2 Second, the |
|
So I've finally had time to fix up the nitro/v3 functionality. Now it uses H3's
When the plugin for Nitro v3 is bundled, it also bundles the reference to WARN Nitro runtime imports detected without a builder or Nitro plugin. A stub implementation will be used.
Actually I think we can just mark
When the Error is logged, it still says 16:42:33.410 ERROR [app] PUT /api/test/update 403 in 261ms
├─ requestId: b191342e-c394-4d2e-a5b3-b35df0574bb2
├─ user: id=999
├─ action: update_item
├─ item: name=My Item version=2.0
├─ validation: checked=true
├─ permissions: checked=true hasUpdate=false requiredRole=admin
└─ error: name=HTTPError message=Update failed stack=HTTPError: Update failed
at createError (file:///home/schplitt/vsc/evlog/packages/evlog/dist/nitro/v3/plugin.mjs:56:10)
at file:///home/schplitt/vsc/evlog/apps/nitro-v3-playground/node_modules/.nitro/dev/index.mjs:819:9Note: In Nitro v3, every Error besides HTTPError is automatically marked as
|
|
@HugoRCD Just following up on this PR. I'm actively using Nitro v3 and would love to land this early support. The issues from my last comment should all be easy to address:
I'm ready to bring this up to feature parity and merge it, but happy to wait for a more stable Nitro v3 release and keep the integration in my own project for now if you prefer. Just let me know which direction works for you. I'd like to move forward when you have a moment. |
|
I don't know, I really want to have Nitro v3 support as soon as possible, but at the same time, I'm not sure if it's reasonable to wait for a more stable version? 🤔 |
|
Early support would be much appreciated. If you are worried about maintance, I am willing to help out as much as I can for keeping the v3 version up to date. 🙂 |
Nice, so let's go and make this happen ! |
|
@HugoRCD Brought it up to speed. Test with nitro v3 use a real development server. If anything like tests or features are missing, just tell me and I'll add them aswell. |
Ty 🙏 I'll take a look at that! |
| export default defineConfig({ | ||
| serverDir: './', | ||
| // TODO: make playground work with evlog/nitro/v3 | ||
| plugins: ['../../packages/evlog/src/nitro-v3/plugin.ts'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weren't we supposed to run the system by just putting evlog/nitro/v3 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the other issue, bun workspaces does not seem to resolve the dependency correctly and thus does not install it into the node_modules dir.
Does it work for you?
| "~/*": ["./*"], | ||
| "evlog": ["../../packages/evlog/src/index.ts"], | ||
| "evlog/*": ["../../packages/evlog/src/*"] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to customize tsconfig? Ideally, I would like the user to have as little to configure as possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bun workspaces does not resolve the types correctly.
It doesn't seem to correctly install the evlog package from the workspace on my machine
| "@nuxt/kit": "^4.3.0", | ||
| "ufo": "^1.6.3" | ||
| }, | ||
| "devDependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made sure that the lib is no longer a dependency. Do you think you can remove that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look how to minimize it/extract the logic to a local function.
Would inlining also be an option?


🔗 Linked issue
resolves #7
📚 Description
This PR adds support for early nitro v3 alpha versions under the
evlog/nitrov3scope.Hope that is alright.
I move shared nitro utilities to a seperate file.
I have adjusted the docs aswell to add a note and a playground.
Nitrov3 currently seems to have issues with runtime config support in monorepos but it should work correctly in a new project.
I am not very familiar with bun so I couldn't get the imports from the node_modules to work and used a relative path instead.
For that reason also please check if I integrated it correctly into the build config.
Please see if you would like to have anything changed!
📝 Checklist